//
//  FLMDropdownMenu.h
//  FLMSuperS
//
//  Created by xiaoyang on 16/9/6.
//  Copyright © 2016年 FaLaoMiaoNetworkTechnologyCo. All rights reserved.
//

#import <UIKit/UIKit.h>

FOUNDATION_EXPORT CGFloat const kFLMDropdownMenuWidth;

typedef NS_ENUM(NSInteger,FLMDropdownMenuType) {
    FLMDropdownMenuLeft,
    FLMDropdownMenuRight,
    FLMDropdownMenuMiddle
};

@class FLMDropdownMenu;
@protocol FLMDropdownMenuDelegate <NSObject>

@optional
/**
 *  当下拉菜单被销毁时调用
 */
- (void)dropdownMenuDidDismiss:(FLMDropdownMenu *)menu;
/**
 *  当下拉菜单显示的时候调用
 */
- (void)dropdownMenuDidShow:(FLMDropdownMenu *)menu;

@end

@protocol FLMDropdownMenuDataSource <NSObject>

- (NSString *)menuTitle;

@optional

/**
 *  当下拉菜单被销毁时调用
 */
- (void)dropdownMenuDidDismiss:(FLMDropdownMenu *)menu;
/**
 *  当下拉菜单显示的时候调用
 */
- (void)dropdownMenuDidShow:(FLMDropdownMenu *)menu;

@end

@interface FLMDropdownMenu : UIView

@property (nonatomic, weak) id<FLMDropdownMenuDelegate> delegate;


+ (instancetype)menu;
+ (instancetype)menuWithType:(FLMDropdownMenuType)type;
/**
 *  显示
 */
- (void)showFrom:(UIView *)from;
- (void)showAtPoint:(CGPoint)start;
/**
 *  隐藏
 */
- (void)dismiss;

/**
 *  内容
 */

//为什么用这个属性呢,就意味着,外部可以方便的添加按钮.添加TableView等控件,外部就不必担心.里面的实现,直接传东西就可以了.
@property (nonatomic, strong) UIView *content;

@property (nonatomic) FLMDropdownMenuType type;

@property (nonatomic, strong) NSMutableArray *titles;
@property (nonatomic, strong) NSMutableArray *images;
/**
 *  内容控制器
 */
@property (nonatomic, strong) UIViewController<FLMDropdownMenuDataSource> *contenController;

- (id)initWithFrame:(CGRect)frame type:(FLMDropdownMenuType)type;

- (NSString *)selectedTitle;

@end
